# -*- coding: utf-8 -*-
"""
created on 2017/12/11 11:30

@author: didichen
"""

# https://www.codewars.com/kata/zero-terminated-sum/python
import re


# def largest_sum(s):
#     s_list = s.strip().split('0')
#     max_sum = 0
#     for substring in s_list:
#         max_list = re.findall(r'\d', substring)
#         temp_sum = sum([int(v) for v in max_list])
#         if temp_sum > max_sum:
#             max_sum = temp_sum
#     return max_sum

def largest_sum(s):
    return max(sum(map(int, x)) for x in s.split('0'))



if __name__ == '__main__':
    s = "72102450111111090"
    print(largest_sum(s))